package com.edu.servlet;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.edu.bean.Book;
import com.edu.service.BookService;
import com.edu.service.UserService;
import com.edu.service.impl.BookServiceImpl;
import com.edu.service.impl.UserServiceImpl;


@WebServlet("/deleteBook.do")
public class DeleteBookServlet extends HttpServlet {
	

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//登录状态的判断?
		Object u = request.getSession().getAttribute("loginUser");
		if(u == null){
			response.sendRedirect("login.jsp");
			return;
		}
		String id = request.getParameter("bookId");
		int bookId = Integer.parseInt(id);
		BookService bs = new BookServiceImpl();
		bs.deleteBookById(bookId);
		response.sendRedirect("book.jsp");
	}

}
